package com.bjmashibing.system.huawei.oppo;

import com.alibaba.fastjson.JSONObject;
import okio.HashingSink;

import java.io.IOException;

import static okio.HashingSink.sha256;

/**
 * @Classname oppo_server
 * @Description TODO
 * @Date 2021/2/28/028 16:24
 * @Created by Administrator
 */
public class oppo_server {
    /*private static boolean refreshToken() throws IOException
    {
        String timestamp = ""+System.currentTimeMillis();
        String sha256= sha256("APP_KEY"+timestamp+"APP_MASTER_SECRET");
        String msgBody = MessageFormat.format(
                "app_key={0}&sign={1}&timestamp={2}",
                URLEncoder.encode(APP_KEY,   "UTF-8"),
                URLEncoder.encode(sha256,    "UTF-8"),
                URLEncoder.encode(timestamp, "UTF-8"));

        String response = PushManager.httpPost(URL_AUTH, msgBody);
        System.out.println("response="+response);
        if (response.indexOf("Not Allowed") > 0)
        {
            return false;
        }

        JSONObject obj = JSONObject.parseObject(response).getJSONObject("data");
        System.out.println("JSONObject="+obj);
        authToken = obj.getString("auth_token");
        tokenExpiredTime = 24*60*60*1000+obj.getLong("create_time") - 5*60*1000;
        return true;
    }*/
}
